use serde::{Deserialize, Serialize};
use sqlx::FromRow;

#[derive(Serialize, Deserialize, FromRow,Clone)]
pub struct User {
    pub id: i32,
    pub name: Option<String>,
    pub email: Option<String>
}

impl User {
    // 可以添加一些与 User 相关的方法

    pub fn new(id: i32, name: Option<&str>, email: Option<&str>) -> Self {
        User {
            id,
            name: name.map(|n| n.to_string()),
            email: email.map(|e| e.to_string()),
        }
    }
}
